package com.cxf.windex.base.util;

import java.math.BigDecimal;
import java.util.Random;

/**
 * @author chenxf
 * @date 4/12/2018
 * @description
 */
public class NumUtil {
  public static BigDecimal getPer(String count,String per){

    return new BigDecimal(count).multiply(new BigDecimal(per)).divide(new BigDecimal(100));
  }

  public static BigDecimal getRestPer(String count,String per){
    return new BigDecimal(count).subtract(getPer(count,per));
  }

  public static int randomInt(int maxValue){
   return new Random().nextInt(maxValue);
  }

  public static void main(String[] args){
    int i=0;
    while(i<10){
      System.out.println(NumUtil.randomInt(2));
      i++;
    }
    System.out.println(NumUtil.getRestPer("10000","10"));

  }
}
